package com.duobaoyu.dby.supply.common.biz.remote.to.refund;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName AfterSaleAttributesVO
 * @Description 商品售后权益
 * @createTime 15:41:00 2022/06/05
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class AfterSaleAttributesTO implements Serializable {

    private static final long serialVersionUID = -751624149250223021L;

    /**
     * 商品售后权益
     */
    private List<Attribute> attributes;

    @Data
    public static class Attribute {
        /**
         * 可退货商品数量
         */
        private Integer permitRetNum;
        /**
         * 可换货商品数量
         */
        private Integer permitChgNum;
		/**
		 * 订单号
		 */
		private String orderSn;
        /**
         * 商品编码
         */
        private String skuCode;

        /**
         * 商品可支持售后送货方式
         * 1 = 上门取件
         * 2 = 客户送货
         * 3 = 客户发货
         * 4 = 其他
         */
        private List<Integer> pickupProducts;
        /**
         * 可支持售后类型
         * 1 = 退货退款
         * 2 = 换货
         * 3 = 维修
         * 4 = 仅退款
         */
        private List<Integer> afterSaleTypes;
        /**
         * 售后原因
         */
        private List<AfterSaleReason> afterSaleReasons;
    }

    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    @Data
    public static class AfterSaleReason {
        /**
         * 售后类型
         * 1 = 退货退款
         * 2 = 换货
         * 3 = 维修
         * 4 = 仅退款
         */
        private Integer afterSaleType;
        /**
         * 对应的售后原因
         */
        private List<Reason> reasons;
    }

    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    @Data
    public static class Reason {
        /**
         * 凭证是否必须上传 "true"表示必须要上传凭证
         */
        private Boolean needVoucher;
        /**
         * 售后原因编码
         */
        private String reasonCode;
        /**
         * 售后原因描述
         */
        private String reasonName;

        @Override
        public Reason clone() {
            return Reason.builder().needVoucher(needVoucher).reasonCode(reasonCode).reasonName(reasonName).build();
        }
    }
}
